﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using hse_2013_local_game2d;
using System.Drawing.Drawing2D;

namespace Planes_and_Ships.Tests
{
    [TestClass]
    public class TestClass
    {
        [TestMethod]
        public void Blows_off_when_hit()
        {
            Random rd = new Random();
            Plane plane = new Plane(new Point(0, 150), 9, 0, new Bitmap("1.png"), new Bitmap("1_on_fire.png"), new Bitmap("splash.png"));
            Lavel currentLavel = new Lavel(new int[] { 560, 850, 1000, 1470, 1680, 2100, 2500, 3000, 4000, 4500, 5000, 5600 },
            new Bitmap("../../ship.png"), new Bitmap("../../ship_on_fire.png"), Color.Blue, Color.Aquamarine, Color.DeepSkyBlue, 6000, 600);
            Wave backWave = new Wave(10, 0.1, plane, Color.Red);
            Ship s = new Ship(backWave, 0, 40, currentLavel.ShipView, currentLavel.AfterExplosionShipView, rd.Next(0, 3));
            Bomb b = new WaterBomb(new Point(10,10), new Bitmap("bomb_explosion.png"), new Bitmap("bomb.png"), plane.Angle, plane.Velocity, plane.UVelocity);
            s.BombHit(b);
            Assert.IsTrue(s.OnFire);
        }
        [TestMethod]
        public void Plane_moves()
        {
            Plane plane = new Plane(new Point(0, 150), 9, 0, new Bitmap("1.png"), new Bitmap("1_on_fire.png"), new Bitmap("splash.png"));
            plane.Move();
            Assert.AreNotEqual(new Point(0, 150),plane.Position);
        }
        [TestMethod]
        public void Bomb_moves()
        {
            Bomb b = new WaterBomb (new Point(10,10), new Bitmap("bomb_explosion.png"), new Bitmap("bomb.png"), 30 ,30, 30);
            b.Move();
            Assert.AreNotEqual(new Point(10, 10), b.Position);
        }
        [TestMethod]
        public void Missile_moves()
        {
            Bomb b = new Missile(new Point(10,10), new Bitmap("../../rocket_explosion.png"), new Bitmap("../../rocket.png"), 30, 30); 
            b.Move();
            Assert.AreNotEqual(new Point(10, 10), b.Position);
        }
        [TestMethod]
        public void Ship_moves_on_waves()
        {
            Point prevPos;
            Random rd = new Random();
            Plane plane = new Plane(new Point(0, 150), 9, 0, new Bitmap("../../1.png"), new Bitmap("../../1_on_fire.png"), new Bitmap("../../splash.png"));
            Lavel currentLavel = new Lavel(new int[] { 560, 850, 1000, 1470, 1680, 2100, 2500, 3000, 4000, 4500, 5000, 5600 },
            new Bitmap("../../ship.png"), new Bitmap("../../ship_on_fire.png"), Color.Blue, Color.Aquamarine, Color.DeepSkyBlue, 6000, 600);
            Wave backWave = new Wave(10, 0.1, plane, Color.Red);
            Ship s = new Ship(backWave, 0, 40, currentLavel.ShipView, currentLavel.AfterExplosionShipView, rd.Next(0, 3));
            prevPos = s.Position;
            s.Move();
            Assert.AreNotEqual(prevPos,s.Position);
        }
    }
}
